package com.dfqy.service;

import com.dfqy.dao.SymDAO;
import com.dfqy.pojo.Sym;
import com.dfqy.vo.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SymService {
    @Autowired
    private SymDAO dao;

    public int add(Sym sym){
        int add = dao.add(sym);
        return add;
    }

    public int delete(long... id) {
        int delete = dao.delete(id);
        return delete;
    }

    public int update(Sym sym) {
        int update = dao.update(sym);
        return update;
    }

    public Page<Sym> paging(int pageNo, int pageSize, String sym,String poster) {
        List<Sym> list = dao.paging(pageNo, pageSize,sym,poster);
        int total=dao.findTotal(sym,poster);
        return new Page<>(list,pageNo,total,pageSize);
    }

    public Sym getInfoById(long id) {
        return dao.selectSymById(id);
    }

    public boolean checktitle(String sym,long id) {
        return dao.checktitle(sym,id) > 0;
    }

    public boolean addchecktitle(String sym) {
        return dao.addchecktitle(sym) > 0;
    }
}
